using System;
using System.Collections.Generic;

namespace CMS.Core.Domain
{
    /// <summary>
    /// PhanQuyenNguoiSuDung object for NHibernate mapped table PhanQuyenNguoiSuDung.
    /// </summary>
    [Serializable]
    public class PhanQuyenNguoiSuDung : DomainObject<PhanQuyenNguoiSuDung.DomainObjectID>
    {

        [Serializable]
        public class DomainObjectID
        {
            public DomainObjectID() {}

            private System.Int32 _MaChucNang;
            private System.String _MaNguoiSuDung;

            public DomainObjectID(System.Int32 maChucNang, System.String maNguoiSuDung)
            {
                _MaChucNang = maChucNang;
                _MaNguoiSuDung = maNguoiSuDung;
            }

         public System.Int32 MaChucNang {
             get { return _MaChucNang; }
             protected set { _MaChucNang = value;}
         }

         public System.String MaNguoiSuDung {
             get { return _MaNguoiSuDung; }
             protected set { _MaNguoiSuDung = value;}
         }


            public override bool Equals(object obj)
            {
                if (obj == this) return true;
                if (obj == null) return false;

                DomainObjectID that = obj as DomainObjectID;
                if (that == null)
                {
                    return false;
                }
                else
                {
                    if (this.MaChucNang != that.MaChucNang) return false;
                    if (this.MaNguoiSuDung != that.MaNguoiSuDung) return false;

                    return true;
                }

            }

            public override int GetHashCode()
            {
                return MaChucNang.GetHashCode() ^ MaNguoiSuDung.GetHashCode();
            }

        }

        private ChucNang _ChucNang;
        private NguoiSuDung _NguoiSuDung;

       

        public PhanQuyenNguoiSuDung()
        {
        }

        public PhanQuyenNguoiSuDung(DomainObjectID id)
        {
            base.ID = id;
        }

         public virtual System.Int32 MaChucNang {
             get { return base.id.MaChucNang; }
         }

         public virtual System.String MaNguoiSuDung {
             get { return base.id.MaNguoiSuDung; }
         }

         public virtual ChucNang ChucNang
         {
             get { return _ChucNang; }
             set { _ChucNang = value; }
         }

         public virtual NguoiSuDung NguoiSuDung
         {
             get { return _NguoiSuDung; }
             set { _NguoiSuDung = value; }
         }

        public override int GetHashCode()
        {
            return ID.GetHashCode();
        }

     }
}
